<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>MQSeries MQGET</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.mqseries-get" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">mqseries_get</h1>
  <p class="verinfo">(PECL mqseries &gt;= 0.10.0)</p><p class="refpurpose"><span class="refname">mqseries_get</span> &mdash; <span class="dc-title">MQSeries MQGET</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.mqseries-get-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>mqseries_get</strong></span>
    ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$hConn</code></span>
   , <span class="methodparam"><span class="type">resource</span> <code class="parameter">$hObj</code></span>
   , <span class="methodparam"><span class="type">array</span> <code class="parameter reference">&$md</code></span>
   , <span class="methodparam"><span class="type">array</span> <code class="parameter reference">&$gmo</code></span>
   , <span class="methodparam"><span class="type">int</span> <code class="parameter reference">&$bufferLength</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter reference">&$msg</code></span>
   , <span class="methodparam"><span class="type">int</span> <code class="parameter reference">&$data_length</code></span>
   , <span class="methodparam"><span class="type">resource</span> <code class="parameter reference">&$compCode</code></span>
   , <span class="methodparam"><span class="type">resource</span> <code class="parameter reference">&$reason</code></span>
   ) : <span class="type"><span class="type void">void</span></span></div>

  <p class="para rdfs-comment">
   The
   <span class="function"><strong>mqseries_get()</strong></span>
   (MQGET) call retrieves a message from a local queue that has been opened
   using the
   <span class="function"><a href="mqseries_open.html" class="function">mqseries_open()</a></span>
   (MQOPEN) call
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.mqseries-get-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>

      <code class="parameter">hConn</code>
     </dt>

     <dd>

      <p class="para">Connection handle.</p>
      <p class="para">This handle represents the connection to the queue manager.</p>
     </dd>

    
    
     <dt>

      <code class="parameter">hObj</code>
     </dt>

     <dd>

      <p class="para">Object handle.</p>
      <p class="para">This handle represents the object to be used.</p>
     </dd>

    
    
     <dt>

      <code class="parameter">md</code>
     </dt>

     <dd>

      <p class="para">Message descriptor (MQMD).</p>
     </dd>

    
    
     <dt>

      <code class="parameter">gmo</code>
     </dt>

     <dd>

      <p class="para">Get message options (MQGMO).</p>
     </dd>

    
    
     <dt>

      <code class="parameter">bufferLength</code>
     </dt>

     <dd>

      <p class="para">Expected length of the result buffer</p>
     </dd>

    
    
     <dt>

      <code class="parameter">msg</code>
     </dt>

     <dd>

      <p class="para">
       Buffer holding the message that was retrieved from the object.
      </p>
     </dd>

    
    
     <dt>

      <code class="parameter">data_length</code>
     </dt>

     <dd>

      <p class="para">Actual buffer length</p>
     </dd>

    
    
     <dt>

      <code class="parameter">compCode</code>
     </dt>

     <dd>

      <p class="para">Completion code.</p>
     </dd>

    
    
     <dt>

      <code class="parameter">reason</code>
     </dt>

     <dd>

      <p class="para">Reason code qualifying the compCode.</p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.mqseries-get-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">没有返回值。</p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.mqseries-get-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-5474">
    <p><strong>Example #1 
     <span class="function"><strong>mqseries_get()</strong></span>
     example
    </strong></p>
    <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">//&nbsp;open&nbsp;connection&nbsp;to&nbsp;the&nbsp;queue&nbsp;manager<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">mqseries_conn</span><span style="color: #007700">(</span><span style="color: #DD0000">'WMQ1'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$conn</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$comp_code</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$reason</span><span style="color: #007700">);<br /></span><span style="color: #FF8000">//&nbsp;$conn&nbsp;now&nbsp;hold&nbsp;the&nbsp;reference&nbsp;to&nbsp;the&nbsp;connection&nbsp;to&nbsp;the&nbsp;queue&nbsp;manager.<br /><br />//&nbsp;open&nbsp;the&nbsp;connection&nbsp;to&nbsp;the&nbsp;testq&nbsp;queue<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">mqseries_open</span><span style="color: #007700">(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$conn</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;array(</span><span style="color: #DD0000">'ObjectName'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'TESTQ'</span><span style="color: #007700">),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">MQSERIES_MQOO_INPUT_AS_Q_DEF&nbsp;</span><span style="color: #007700">|&nbsp;</span><span style="color: #0000BB">MQSERIES_MQOO_FAIL_IF_QUIESCING&nbsp;</span><span style="color: #007700">|&nbsp;</span><span style="color: #0000BB">MQSERIES_MQOO_OUTPUT</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$obj</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$comp_code</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$reason</span><span style="color: #007700">);<br /></span><span style="color: #FF8000">//&nbsp;$obj&nbsp;now&nbsp;holds&nbsp;the&nbsp;reference&nbsp;to&nbsp;the&nbsp;object&nbsp;(TESTQ)<br /><br />//&nbsp;setup&nbsp;empty&nbsp;message&nbsp;descriptor.<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$mdg&nbsp;</span><span style="color: #007700">=&nbsp;array();<br /></span><span style="color: #FF8000">//&nbsp;setup&nbsp;get&nbsp;message&nbsp;options&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$gmo&nbsp;</span><span style="color: #007700">=&nbsp;array(</span><span style="color: #DD0000">'Options'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">MQSERIES_MQGMO_FAIL_IF_QUIESCING&nbsp;</span><span style="color: #007700">|&nbsp;</span><span style="color: #0000BB">MQSERIES_MQGMO_WAIT</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'WaitInterval'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">3000</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;get&nbsp;the&nbsp;message&nbsp;from&nbsp;the&nbsp;queue&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">mqseries_get</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$obj</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$mdg</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$gmo</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">255</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$msg</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$data_length</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$comp_code</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$reason</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(</span><span style="color: #0000BB">$comp_code&nbsp;</span><span style="color: #007700">!==&nbsp;</span><span style="color: #0000BB">MQSERIES_MQCC_OK</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">printf</span><span style="color: #007700">(</span><span style="color: #DD0000">"GET&nbsp;CompCode:%d&nbsp;Reason:%d&nbsp;Text:%s&lt;br&gt;"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$comp_code</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$reason</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">mqseries_strerror</span><span style="color: #007700">(</span><span style="color: #0000BB">$reason</span><span style="color: #007700">));<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;<br /></span><span style="color: #FF8000">//&nbsp;close&nbsp;the&nbsp;object&nbsp;reference&nbsp;$obj&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">mqseries_close</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$obj</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">MQSERIES_MQCO_NONE</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$comp_code</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$reason</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;disconnect&nbsp;from&nbsp;the&nbsp;queue&nbsp;manager.&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">mqseries_disc</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$comp_code</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$reason</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.mqseries-get-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="mqseries_conn.html" class="function" rel="rdfs-seeAlso">mqseries_conn()</a> - MQSeries MQCONN</span></li>
    <li class="member"><span class="function"><a href="mqseries_connx.html" class="function" rel="rdfs-seeAlso">mqseries_connx()</a> - MQSeries MQCONNX</span></li>
    <li class="member"><span class="function"><a href="mqseries_open.html" class="function" rel="rdfs-seeAlso">mqseries_open()</a> - MQSeries MQOPEN</span></li>
    <li class="member"><span class="function"><a href="mqseries_put.html" class="function" rel="rdfs-seeAlso">mqseries_put()</a> - MQSeries MQPUT</span></li>
   </ul>
  </p>
 </div>

</div></div></div></body></html>